﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TMIS.DAL
{
    public class Approval
    {
        private Model.ThesisDB db = new Model.ThesisDB();

        #region 生成新的审批表信息
        public void Insert(Model.Approval approval)
        {
            db.Approval.InsertOnSubmit(approval);
            db.SubmitChanges();
        }
        #endregion

        #region 更新审批表信息
        public void Update(Model.Approval approval)
        {
            Model.Approval app = db.Approval.FirstOrDefault(e => e.ID == approval.ID);
            app.Context = approval.Context;
            app.Literature = approval.Literature;
            app.OpenReport = approval.OpenReport;
            app.Document = approval.Document;
            app.Internship = approval.Internship;
            app.Instructe = approval.Instructe;
            app.Other = approval.Other;
            app.BeginDate = approval.BeginDate;
            app.CompleteDate = approval.CompleteDate;
            db.SubmitChanges();
        }
        #endregion

        /// <summary>
        /// 获取指定ID号的选题审批表
        /// </summary>
        /// <param name="guid"></param>
        public Model.Approval Get(Guid guid)
        {
            Model.Approval app=db.Approval.FirstOrDefault(e => e.ID == guid);
            return app;
        }

    }
}
